package com.zyx.inputStream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Demo4 {

    public static void main(String[] args) {
        FileInputStream fis=null;
        //File file = new File("D:\\b.txt");
        try {
            StringBuffer sb = new StringBuffer();
            fis = new FileInputStream("F:\\nsdJava\\java0720.txt");
            int length = 0;
            byte[] b = new byte[1024];
            while((length = fis.read(b))!=-1){
                //System.out.println(length);
                sb.append(new String(b,0,length));
                //System.out.println(new String(b,0,length));
            }
            System.out.println(sb);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }finally{
            if(fis!=null){
                try {
                    fis.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }



    }
}
